package com.navi.loaddata.loadService.impl.baseData;

import com.navi.loaddata.core.gpEntity.MParamD;
import com.navi.loaddata.core.gpEntity.base.MParamDMapper;
import com.navi.loaddata.core.oracleEntity.base.EtlParamV;
import com.navi.loaddata.core.repository.impl.GreenPlumRepositoryImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional(transactionManager = "secondaryPlatformTransactionManager",
        rollbackFor = {RuntimeException.class, Exception.class})
public class LoadBaseDataService {

    @Autowired
    private GreenPlumRepositoryImpl dao2;

    public List<MParamD> loadParamInfo(String shopName) {
        return dao2.list(MParamD.class, "FROM MParamD where shopName='" + shopName + "' ");
    }

    public List<EtlParamV> loadEtlParamVInfo(String shopName) {
        List<MParamD>  mParamDList = loadParamInfo(shopName);
        return MParamDMapper.INSTANCE.mParamToEtl(mParamDList);
    }
}
